package com.ptszyxx.popose.common.utils;

import com.ptszyxx.popose.common.enums.ActionEnum;
import com.ysg.base.BaseViewModel;
import com.ysg.http.BaseResponse;
import com.ysg.http.HttpUtils;
import com.ysg.http.callback.OnSuccessResult;
import com.ysg.http.data.CommonRepository;
import com.ysg.utils.YPhoneUtil;
import com.ysg.utils.YSPUtils;
import com.ysg.utils.YStringUtil;

import java.util.HashMap;
import java.util.Map;

public class YActionEventUtil {

    private static YActionEventUtil instance;

    private YActionEventUtil(){
    }

    public static YActionEventUtil getInstance(){
        if (instance == null){
            synchronized (YActionEventUtil.class){
                if (instance == null){
                    instance = new YActionEventUtil();
                }
            }
        }
        return instance;
    }


    /**
     * 行为日志
     */
    public void upload(BaseViewModel viewModel, CommonRepository model, ActionEnum actionEnum) {
//        Map<String, String> map = new HashMap<>();
//        map.put("opName", actionEnum.getName());
//        map.put("mobileSpec", YPhoneUtil.getModel());
//        String userId = YSPUtils.getInstance().getUserId();
//        if (YStringUtil.isNotEmpty(userId)){
//            map.put("userId", userId);
//        }
//        String oaid = YSPUtils.getInstance().getOAID();
//        if (YStringUtil.isNotEmpty(oaid)){
//            map.put("imei", oaid);
//        }
//        HttpUtils.getInstance()
//                .data(model.actionLog(map), viewModel,
//                        new OnSuccessResult() {
//                            @Override
//                            public void onSuccessResult(BaseResponse response) {
//                            }
//                        });
    }



}
